xen/credit2: soft-affinity awareness in runq_tickle()
authorGeorge Dunlap <george.dunlap@citrix.com>
Tue, 29 Aug 2017 09:18:49 +0000 (10:18 +0100)
committerGeorge Dunlap <george.dunlap@citrix.com>
Tue, 29 Aug 2017 09:18:49 +0000 (10:18 +0100)
commit72faea71260197afa916d13611d4aa10875a25fb
treed746352875db8b391c91e96c4996d9cb30626040
parentf0c1fc7b4c86af9a8de585b4cb2f7792817f404d
xen/credit2: soft-affinity awareness in runq_tickle()

Soft-affinity support is usually implemented by means
of a two step "balancing loop", where:
- during the first step, we consider soft-affinity
  (if the vcpu has one);
- during the second (if we get to it), we consider
  hard-affinity.

In runq_tickle(), we need to do that for checking
whether we can execute the waking vCPU on an pCPU
that is idle. In fact, we want to be sure that, if
there is an idle pCPU in the vCPU's soft affinity,
we'll use it.

If there are no such idle pCPUs, though, and we
have to check non-idle ones, we can avoid the loop
and to both hard and soft-affinity in one pass.

In fact, we can we scan runqueue and compute a
"score" for each vCPU which is running on each pCPU.
The idea is, since we may have to preempt someone:
- try to make sure that the waking vCPU will run
  inside its soft-affinity,
- try to preempt someone that is running outside
  of its own soft-affinity.

The value of the score is added to a trace record,
so xenalyze's code and tools/xentrace/formats are
updated accordingly.

Suggested-by: George Dunlap <george.dunlap@citrix.com>
Signed-off-by: Dario Faggioli <dario.faggioli@citrix.com>
Reviewed-by: George Dunlap <george.dunlap@citrix.com>
tools/xentrace/formats
tools/xentrace/xenalyze.c
xen/common/sched_credit2.c